﻿@model IPager

<ul class="tsc_pagination" style="float: right;">
    @if (1 < Model.CurrentPage)
    {
        <li><a class="first" href="@Model.GetLinkForPage(1)">«</a></li>
    }

    @if (Model.CurrentPage > 1)
    {
        <li><a class="previous" href="@Model.GetLinkForPage(Model.CurrentPage - 1)">‹</a></li>
    }

    @if (Model.StartDisplayedPage > 1)
    {
        if (Model.PageCount > 1)
        { 
        <li><a  href="@Model.GetLinkForPage(1)">1</a></li>
        }

        if (Model.StartDisplayedPage > 2)
        {
        <li><a  href="@Model.GetLinkForPage(Model.StartDisplayedPage - 1)">...</a></li>
        }
    }
    @for (int i = Model.StartDisplayedPage; i <= Model.EndDisplayedPage; i++)
    {
        if (i == Model.CurrentPage)
        {
            if (Model.PageCount > 1)
            { 
        <li><a class="current">@i</a></li>
            }
        }
        else
        {
        <li><a class="pager-link" href="@Model.GetLinkForPage(i)">@i</a></li>
        }
    }
    @if (Model.EndDisplayedPage < Model.PageCount)
    {
        if (Model.EndDisplayedPage < Model.PageCount - 1)
        {
        <li><a class="pager-link" href="@Model.GetLinkForPage(Model.EndDisplayedPage + 1)">...</a></li>
        }
        <li><a class="pager-link" href="@Model.GetLinkForPage(Model.PageCount)">@Model.PageCount</a></li>
    }
    @if (Model.CurrentPage < Model.PageCount)
    {
        <li><a class="next" href="@Model.GetLinkForPage(Model.CurrentPage + 1)">›</a></li>
    }

    @if (Model.CurrentPage < Model.PageCount)
    {
        <li><a class="last" href="@Model.GetLinkForPage(Model.PageCount)">»</a></li>
    }

</ul>
<br style="clear: both;" />
